package com.wangsd.web.mqpay.mapper;

import com.gitee.fastmybatis.core.mapper.CrudMapper;
import com.wangsd.web.mqpay.entity.Merchant;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MerchantMapper extends CrudMapper<Merchant, Long> {

    @Select("select * from merchant where pay_type=#{payType} " +
            "and real_amount < usable_amount and is_valid = true and parent_code=#{parentCode}" +
            "ORDER BY receive_time ASC limit 1")
    List<Merchant> selectByReceiveTimeOrder(@Param("payType") Integer payType, @Param("parentCode") String parentCode);
}
